package gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

import java.awt.Font;

import javax.swing.JButton;

import com.mysql.jdbc.log.Jdk14Logger;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;

public class JFrameTeacherMainPage extends JFrame {

	private JPanel contentPane;
	public static String ID;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JFrameTeacherMainPage frame = new JFrameTeacherMainPage();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public JFrameTeacherMainPage() {
		setTitle("Teacher - Main page");
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 550, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		JLabel lblTeacherMenu = new JLabel("Teacher Menu");
		lblTeacherMenu.setFont(new Font("Tahoma", Font.BOLD, 30));
		lblTeacherMenu.setHorizontalAlignment(SwingConstants.CENTER);
		lblTeacherMenu.setBounds(125, 10, 300, 50);
		contentPane.add(lblTeacherMenu);

		JButton btnViewStudentResult = new JButton("View Student's Result");
		btnViewStudentResult.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JFrameStudentViewResult jFrameStudentViewResult = new JFrameStudentViewResult();
				jFrameStudentViewResult.setVisible(true);
				dispose();
			}
		});
		btnViewStudentResult.setFont(new Font("Tahoma", Font.PLAIN, 18));
		btnViewStudentResult.setBounds(150, 80, 250, 60);
		contentPane.add(btnViewStudentResult);

		JButton btnViewQuizAnswers = new JButton("View Quiz Correct Answers");
		btnViewQuizAnswers.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			}
		});
		btnViewQuizAnswers.setFont(new Font("Tahoma", Font.PLAIN, 18));
		btnViewQuizAnswers.setBounds(150, 180, 250, 60);
		contentPane.add(btnViewQuizAnswers);

		JButton btnSignOut = new JButton("");
		btnSignOut.setIcon(new ImageIcon("resource\\btn_signout.png"));
		btnSignOut.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if  (JOptionPane.showConfirmDialog(JFrameTeacherMainPage.this,
						"Do you want to sign out?","Confirm",JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {

						JFrameLogin jFrameLogin = new  JFrameLogin();
						jFrameLogin.setVisible(true);
						dispose();
				}
			}
		});
		btnSignOut.setFont(new Font("Tahoma", Font.PLAIN, 18));
		btnSignOut.setBounds(450, 20, 50, 50);
		contentPane.add(btnSignOut);
	}

}
